<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<?php
		global $current_controller;
	
		//http-equiv meta tags
		XHTML::Meta('http-equiv', 'Content-Type', 'text/html; charset=utf-8');
		XHTML::Meta('http-equiv', 'content-language', Language::getShortName());
		
		//named meta tags
		XHTML::Meta('name', 'robots', 'index,follow');
		XHTML::Meta('name', 'design', 'DQ Team');
		XHTML::Meta('name', 'powered by', 'SpherusFramework 2.10');
		XHTML::Meta('name', 'author', 'Perkin Anton [DeveloperMD]');
		
		//common css files
		XHTML::CSSBuffer(substr(THEMES.SEPARATOR.$current_controller->theme.SEPARATOR.'site', 1));
		XHTML::CSSBuffer(SITE_JS.SEPARATOR.'jquery-ui-1.8.16.custom');
		XHTML::DisplayCSSBuffer();

		//common javascript files
		XHTML::JSBuffer(SITE_JS.SEPARATOR.'jquery-1.6.2.min');
		XHTML::JSBuffer(SITE_JS.SEPARATOR.'dq-ui-1.0');
		XHTML::JSBuffer(SITE_JS.SEPARATOR.'jquery-ui-1.8.16.custom.min');
		XHTML::JSBuffer(SITE_JS.SEPARATOR.'functions');
		
		//additional javascript files
		$current_controller->IncludeJavascriptFiles();
		XHTML::DisplayJSBuffer();
	   
		//jquery component
//    	jQuery::Initialize();
		
		//page title
		XHTML::Title(LANG_PROJECT_NAME.' :: '.strip_tags($current_controller->page_title));
	?>
	
	</head>
	<body onload="<?php //echo $current_controller->onload; ?>updateClock(); setInterval('updateClock()', 1000 )">
		<table border="0" cellspacing="0" cellpadding="0" class="all">
		  	<!-- TOPLINE -->
		  	<?php
		  		$current_controller->IncludeThemeElement('site_top');
		  	?>
	  	  	<!-- /TOPLINE -->

		  	<!-- HEADER -->
		  	<?php
		  		if (!empty(HTTPContext::$session['client']))
		  		{
		  			$current_controller->IncludeThemeElement('site_header');
		  		}
		  		else 
		  		{
		  			$current_controller->IncludeThemeElement('site_header_public');
		  		}		  	
		  	?>
		  	<!-- /HEADER -->
	
		  	<!-- LEFT COLUMN -->
		  	<?php
		  		if ($current_controller->hasLeftColumn) 
		  		{
//		  			$current_controller->IncludeThemeElement('site_left');
		  		}
		  		else 
		  		{

		  		}
		  	?>
	  	  	<!-- /LEFT COLUMN -->		

			<?php 
				echo $page_content;
			?>
			
		  	<!-- FOOTER -->
		  	<?php
		  		$current_controller->IncludeThemeElement('site_footer');
		  	?>
	  	  	<!-- /FOOTER -->
		</table>
		
		<?php 
		
		  	$current_controller->IncludeThemeElement('site_contact');
			$current_controller->IncludeThemeElement('site_support');
		  	$current_controller->IncludeThemeElement('site_tour');
		
			if ($current_controller->menuItem == 'home')
			{
				if (!empty($current_controller->controller_model->validation_errors))
				{
					$emailError = (!empty($current_controller->controller_model->validation_errors['email'])) ? "<span class = 'error'>: {$current_controller->controller_model->validation_errors['email']}</span>" : '';
					$passwordError = (!empty($current_controller->controller_model->validation_errors['password'])) ? "<span class = 'error'>: {$current_controller->controller_model->validation_errors['password']}</span>" : '';
				}
					
				echo "
					<!-- LOGIN BOX -->
					<div id='dialogID' style='display: none;' >
						<form method = 'POST' action = '/' id = 'loginForm'>
						<div class='lp1 lpad10 rpad10 bpad10'><span class='size18'>".Language::Get('Sign in')."</span></div>
					  	<div class='lpad10 rpad10 tpad10'>
					    	<div class='lpad10 bpad5 c84'>".Language::Get('Email')."$emailError</div>
					    	<div class='dq-input-text'><input type='text' name = 'email' value = '".HTTPContext::$post['email']."' /></div>        
					    	<div class='lpad10 tpad5 bpad5 c84'>".Language::Get('Password')."$passwordError</div>
					    	<div class='dq-input-text'><input type='password' name = 'password' /></div>
					    	<div class='tpad5'>
					      		<table border='0' cellspacing='0' cellpadding='0' width='100%'>
					      			<tr>
					        			<td align='left'><a href='#' onclick = '$(\"#dialogID\").fadeOut(); $(\"#recoverBox\").dqDialog(\"open\",{width:\"350\", top:\"285\"}); return false; ' class='c84'>".Language::Get('Forgot password')."?</a></td>
					        			<td width='140' id='btnLogin' onclick = '$(\"#loginForm\").submit(); '>".Language::Get('Access', 'CAPITALIZE')."</td>
					      			</tr>
					      		</table>
					    	</div>
					  	</div>
					  	</form>
					</div>
					<!-- /LOGIN BOX -->
					
					<!-- RECOVERY BOX -->
					<div id='recoverBox' style='display: none;' >
						<form method = 'POST' action = '/clients/recover/' id = 'recoverForm'>
						<div class='lp1 lpad10 rpad10 bpad10'><span class='size18'>".Language::Get('Password recovery')."</span></div>
					  	<div class='lpad10 rpad10 tpad10'>
					    	<div class='lpad10 bpad5 c84'>".Language::Get('Email')."$emailError</div>
					    	<div class='dq-input-text'><input type='text' name = 'email' value = '".HTTPContext::$post['email']."' /></div>        
					    	<div class='tpad5'>
					      		<table border='0' cellspacing='0' cellpadding='0' width='100%'>
					      			<tr>
					        			<td width='90' id='btnRecover' onclick = '$(\"#recoverForm\").submit(); '>".Language::Get('Recover')."</td>
					      			</tr>
					      		</table>
					    	</div>
					  	</div>
					  	</form>
					</div>
					<!-- /RECOVERY BOX -->				
					
					<!-- INFO BOX -->
					<div id='infoBox' style='display: none;' >
						<div class='lp1 lpad10 rpad10 bpad10'><span class='size18'>".Language::Get('Password recovery')."</span></div>
					  	<div class='lpad10 rpad10 tpad10'>
					    	<div class='lpad10 bpad5 c84'>".Language::Get('Email')."$emailError</div>
					    	<div class='dq-input-text'><input type='text' name = 'email' value = '".HTTPContext::$post['email']."' /></div>        
					    	<div class='tpad5'>
					      		<table border='0' cellspacing='0' cellpadding='0' width='100%'>
					      			<tr>
					        			<td width='90' id='btnRecover' onclick = '$(\"#recoverForm\").submit(); '>".Language::Get('Recover')."</td>
					      			</tr>
					      		</table>
					    	</div>
					  	</div>
					</div>
					<!-- /INFO BOX -->
					
					<!-- SOCIAL BOX -->
					<div id='socialID' style='display: none; height: 120px; ' >
						<div class='lp1 lpad10 rpad10 bpad10'><span class='size18'>".Language::Get('Promote')."</span></div>
					  	<div class='lpad10 rpad10 tpad10'>";
							echo HtmlsHelper::FacebookLike();	
							echo HtmlsHelper::Tweet();	
							echo HtmlsHelper::LinkedInButton();	
							echo "<div style = 'margin-top: 7px; '>".HtmlsHelper::GooglePlusButton()."</div>";
//							echo "<div style = 'margin-top: 7px; '>".HtmlsHelper::VkontakteLike()."</div>";
							echo "<div style = 'margin-top: 7px; '>".HtmlsHelper::FormspringButton()."</div>";	
							echo HtmlsHelper::OdnoklassnikiButton();	
							echo HtmlsHelper::MySpaceButton();	
							echo HtmlsHelper::NingButton();	
							echo HtmlsHelper::Kaixin001Button();	
							echo HtmlsHelper::RenrenButton();	
	echo "				</div>
					</div>	
					<!-- /SOCIAL BOX -->	

					<script type='text/javascript'>
						$('#socialID').dqDialog({});
					</script>";		
							
	echo "			<script type='text/javascript'>
						 $('#dialogID').dqDialog({});	
						 $('#recoverBox').dqDialog();
						 $('.btnCloseContainer').attr('style', 'float: right; ');	
						 $('.dq-input-text').dqInput();
						 $('#btnLogin').dqButton({type:5, action:'#', clickType:'href'});
						 $('#btnRecover').dqButton({type:5, action:'#', clickType:'href'});
						 $('#btnMarkedd').dqImgOver({over:'".SITE_IMAGES."btn_markedd_over.png', out:'".SITE_IMAGES."btn_markedd.png'});
						 $('#btnSignIn').dqImgOver({over:'".SITE_IMAGES."btn_lottery_over.png', out:'".SITE_IMAGES."btn_lottery.png'});
						 $('#btnHowWorks').dqImgOver({over:'".SITE_IMAGES."btn_deposits_over.png', out:'".SITE_IMAGES."btn_deposits.png'});
						 $('#btnTipsHints').dqImgOver({over:'".SITE_IMAGES."btn_tips_hints_over.png', out:'".SITE_IMAGES."btn_tips_hints.png'});
					</script>				
				";
				
				if (!empty($current_controller->controller_model->validation_errors) || (HTTPContext::$get['login'] == 1))
				{
					XHTML::Script('text/javascript', "
						$('#dialogID').dqDialog('open',{width:'350', top:'285'});
					");
				}	
				

			
			}

	echo "			<script type='text/javascript'>
						 $('.btnCloseContainer').attr('style', 'float: right; ');	
					</script>				
				";
		?>
		
	</body>
</html>